package de.fuberlin.inf.alp2;

public class CDLNode {
	private CDLNode previous;
	private CDLNode next;
	@SuppressWarnings("unchecked")
    private Comparable value;
	
	/**
	 * Constructor creates a new node behind the previous node
	 * @param value
	 * @param previous
	 */
	@SuppressWarnings("unchecked")
    public CDLNode(Comparable value, CDLNode previous){
		this.value = value;
		
		if (previous != null){
			this.next = previous.next;
			this.previous = previous;
			previous.next = this;
			this.next.previous = this;
		}
	}
	public CDLNode getPrevious() {
		return previous;
	}
	public void setPrevious(CDLNode previous) {
		this.previous = previous;
	}
	public CDLNode getNext() {
		return next;
	}
	public void setNext(CDLNode next) {
		this.next = next;
	}
	@SuppressWarnings("unchecked")
    public Comparable getValue() {
		return value;
	}
	@SuppressWarnings("unchecked")
    public void setValue(Comparable value) {
		this.value = value;
	}
}
